#! /bin/sh

DAEMON=/sbin/bootlogd
DAEMON_OPTS="-r -c"

. /lib/lsb/init-functions

[ -r /etc/sysconfig/bootlogd ] && . /etc/sysconfig/bootlogd

case "$BOOTLOGD_ENABLE" in
[Nn]*) exit 0;;
esac

do_start()
{
	log_info_msg "Starting bootlogd"
	start_daemon -p /var/run/bootlogd.pid \
		/sbin/bootlogd -r -c && \
		log_success_msg || log_failure_msg
}

do_stop()
{
	log_info_msg "Stopping bootlogd"
	stop_daemon -p /var/run/bootlogd.pid /sbin/bootlogd && \
		log_success_msg || log_failure_msg
	[ -e /var/log/boot ] && mv /var/log/boot{,.bak} || true
}

case "$1" in
	start) do_start ;;
	stop) do_stop ;;
	restart|reload) do_stop; do_start;;
	*) echo "Usage: $0 {start|stop|restart}" >&2; exit 1;;
esac
